import React, { Component } from "react";
import { Table } from "antd";

class TableList extends Component {
  render() {
    const {
      data = [],
      loading = false,
      handleTableChange = () => {},
      pageNum,
      totalCount,
      columns,
      rowSelection,
      rowKey,
    } = this.props;
    return (
      <Table
        locale={{ emptyText: "暂无数据！" }}
        rowKey={rowKey}
        rowSelection={rowSelection}
        loading={loading}
        columns={columns}
        dataSource={data}
        onChange={(e, filters, sorter) => handleTableChange(e, filters, sorter)}
        pagination={{
          defaultPageSize: 10,
          showQuickJumper: true,
          showSizeChanger: true,
          current: pageNum,
          total: totalCount,
          showTotal: (total) => `共有 ${total} 条`,
        }}
      />
    );
  }
}

export default TableList;
